#pragma once

#include ".\WinCore\WinCore.h"

#define  _APPNAME   _T("Demo 0013")

//////////////////////////////////////////////////////////////////////////
// CDemoApp
//////////////////////////////////////////////////////////////////////////
class CDemoApp : public CWinApp
{
public:
	CDemoApp();
	~CDemoApp();
	
protected:
	bool	InitInstance();
};

//////////////////////////////////////////////////////////////////////////
// CDemoWnd
//////////////////////////////////////////////////////////////////////////
class CDemoWnd : public CWinWnd
{
protected:
	struct TMSGMAP {
		typedef LRESULT (CDemoWnd::*MSGPROC)(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);

		UINT		m_nMsg;
		MSGPROC		m_MsgProc;
	};

public: 
	CDemoWnd(const TCHAR* szAppName = _APPNAME);
	~CDemoWnd();

protected:
	LRESULT		WndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);

protected:
	LRESULT		OnCreate(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
	LRESULT		OnDestroy(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
	LRESULT		OnPaint(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
	LRESULT		OnLButtonDown(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
	LRESULT		OnLButtonUp(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
	LRESULT		OnSize(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
	LRESULT		OnCommand(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam);
private:
	void		_PartitionGrid(HDC hDC, RECT* prtGrids, int nGridCount);
	void		_BitBltBmp(HDC hDC, RECT& rtGrids);
	void		_StretchBltBmp(HDC hDC, RECT& rtGrids);

	void		_PatBltBmp(HDC hDC, RECT& rtGrids);
	void		_BlendBmp(HDC hDC, RECT& rtGrids);
	void		_TransparentBltBmp(HDC hDC, RECT& rtGrids);
	void		_MaskBltBmp(HDC hDC, RECT& rtGrids);
private:
	
private:
	static const UINT m_nCtrlCount = 10;
	HWND		m_hCtrls[10];

	HBITMAP		m_hBitmap;
	HBITMAP		m_hBitmap2;
	static const TMSGMAP MsgMapTable[];
};
